package com.turing.data.engine.utils;

public class MatchedGroup implements Comparable<MatchedGroup> {
    private long indexStart;//子串在全文中的开始位置
    private long indexEnd;//子串在全文中的结束位置
    private String sonOfStr;//子串内容


    public long getIndexStart() {
        return indexStart;
    }

    public void setIndexStart(long indexStart) {
        this.indexStart = indexStart;
    }

    public long getIndexEnd() {
        return indexEnd;
    }

    public void setIndexEnd(long indexEnd) {
        this.indexEnd = indexEnd;
    }

    public String getSonOfStr() {
        return sonOfStr;
    }

    public void setSonOfStr(String sonOfStr) {
        this.sonOfStr = sonOfStr;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"indexStart\":")
                .append(indexStart);
        sb.append(",\"indexEnd\":")
                .append(indexEnd);
        sb.append(",\"sonOfStr\":\"")
                .append(sonOfStr).append('\"');
        sb.append('}');
        return sb.toString();
    }

    @Override
    public int compareTo(MatchedGroup o) {
        return (int) (this.indexEnd - o.indexEnd);
    }
}